export default (url, type="get", dataType="json")=>{
	
	return new Promise((resolve, reject)=>{
		
		var request = new XMLHttpRequest();
		request.responseType = dataType;
		
		request.onreadystatechange = ()=>{
			if(request.readyState == 4){
				if(request.status == 200){
					
					console.log('utils', request.response);
					
					resolve(request.response)
					
				}
			}
		}
		
		request.open(type, url);
		
		request.send();
		
	})
	
}
